import { ref } from 'vue'
import { defineStore } from 'pinia'

export const useStore = defineStore('haokan', () => {

  const navBarActive = ref(0)

  const openFirstChapterId = ref(0)

  const openComicId = ref(0)

  const showPopUp = ref(false)

  const tabListName = ref('')


  const chapterIdList = ref([])

  const chapterInfoList = ref([])

  const currentChapterIndex = ref(0)



  function setNavBarActive (index) {
    navBarActive.value = index
  }

  function setOpenFirstChapterId (id) {
    openFirstChapterId.value = id
  }


  function setOpenComicId (id) {
    openComicId.value = id
  }

  function setShowPopUp (bool) {
    showPopUp.value = bool
  }


  function setTabListName (string) {

    tabListName.value = string

  }

  function setChapterIdList (list) {
    chapterIdList.value = list
  }

  function setChapterInfoList (list) {
    chapterInfoList.value = list
  }

  function setCurrentChapterIndex (index) {
    currentChapterIndex.value = index
  }



  return { navBarActive, setNavBarActive, openFirstChapterId, setOpenFirstChapterId, openComicId, setOpenComicId, showPopUp, setShowPopUp, tabListName, setTabListName, chapterIdList, setChapterIdList, chapterInfoList, setChapterInfoList, currentChapterIndex, setCurrentChapterIndex }
})
